#ifndef CCOMPASSPROTOCOL_H
#define CCOMPASSPROTOCOL_H

#include <QObject>

#include "cxserialport.h"
#include <QTimer>
#include <QVector>
#include <QVariant>
class CCompassProtocol : public QObject
{
    Q_OBJECT
public:
    CXSerialPort *m_serial;
    QTimer *m_readtimer;
    QTimer *m_onlinetimeout;
    QByteArray *m_serialdatabuffer;
    explicit CCompassProtocol(QObject *parent = 0);
   // void pushCommand(QByteArray cmd);
    bool pickCommand();
    int findNextHeader();
    //bool compassRegistFloor(unsigned char  currentfloor,unsigned char  destfloor,int icid);

signals:
    void debugSerial(QByteArray msg);
    void offline();
    void online();
    void regf(QVariant);
    void unregf(QVariant);
    void assignLift(QVector<int>*);//楼层等级信息
    void floorState(QVariant);//楼层状态信号;
public slots:
    void readSerial();
    void pushCommand(int cmd);
    void pushCommand();
    void getregflr();
    //void getflrinfo();
private :
    QVector<int>* registerFloor;
    int getDecimalfromByte(unsigned int );
    bool isPicking;
    int  pickCount;
};

#endif // CCOMPASSPROTOCOL_H
